package com.example;

import java.util.LinkedHashMap;
import java.util.Set;

public class Test2 {
    public static void main(String[] args) {
        LinkedHashMap<Character, Integer> map = new LinkedHashMap<>();
        char[] chars = "aahelloa".toCharArray();

        int i = 0;
        for (char c : chars) {
            map.put(c, i++);
        }
        StringBuilder sb = new StringBuilder();
        Set<Character> set = map.keySet();
        for (Character c : set) {
            sb.append(c);
        }
        System.out.println(sb.toString());
    }
}
